<%-- 
    Document   : astaDetails
    Created on : 4-gen-2013, 16.40.17
    Author     : Luciano
--%>


<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.items.UM"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.items.Asta"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.items.User"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.items.Product"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.DBManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
        Asta a;
        if(request.getAttribute("asta")!=null){
            a=(Asta)request.getAttribute("asta");
        }else{
            a=(Asta)session.getAttribute("asta");
            session.removeAttribute("asta");
            request.setAttribute("asta",a);
        }
        session.removeAttribute("asta");
        String mess="";
        if(session.getAttribute("error_on")!=null){
            mess="Unable to add the offer.<br/>"
                 + "You have an error on field:<br/>"
                 + (String)session.getAttribute("error_on") ;
            session.removeAttribute("error_on");
        }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>add Offer</title>
    </head>
    <body>
        <jsp:include page="./astaDetails.jsp" flush="true" />
        <div class="content">
            <h1>Add Offer</h1>
        <p id="add_offer_error_log"><%=mess%></p>
        
         <form name="form_add_offer" method="post"
                action="<%=response.encodeURL(request.getContextPath()+"/services/addOfferToDB")%>" >
                    <table>
                        <tr>
                            <input type="hidden" name="asta_id" value="<%=a.getId() %>" />
                            <td>Max offer price:(more or equal then <%=a.getMinimumValidOffer()%>) </td>
                                <td>
                                    <input type=text 
                                    name="offer_price"
                                    value=""
                                    />
                                    euro ;
                                </td>
                            </tr>
                            
                        <tr>
                            <td>
                                <input type="button"
                                       onclick="ValidateOffer()"
                                    name="add_offer"
                                    value="add offer"  
                                 />
                            </td>
                        </tr>
                    </table>
                    <script type="text/javascript" 
                        src="<%=request.getContextPath()%>/javascript/addOffer.js">
                    </script>
            </form>
        </div>
        
        
    </body>
</html>